class Solution {
    public int removeDuplicates(int[] nums) {
        int count=0;
        int start=0;
        for(int i=0;i<nums.length;i++){
            if(nums[start]!=nums[i]){ 
               nums[count++]=nums[start];
               start=i;
            }
        }
        nums[count++]=nums[nums.length-1];
        return count;
    }
}